#语法糖--装饰器
# def out(org):
#     def inner():
#         print("开始")
#         res=org()
#         print("结束")
#         return res
#     return inner
# @out
# def test():
#     print("我是test函数")
# test()

# def outer(origin):
#     def inner(*args, **kwargs):
#         print("before ")
#         res = origin(*args, **kwargs)  # 调用原来的func函数
#         print("after")
#         return res
#
#     return inner
#
#
# @outer  # func1 = outer(func1)
# def func1(a1):
#     print("我是func1函数")
#     value = (11, 22, 33, 44)
#     return value
#
#
# @outer  # func2 = outer(func2)
# def func2(a1, a2):
#     print("我是func2函数")
#     value = (11, 22, 33, 44)
#     return value
#
#
# @outer  # func3 = outer(func3)
# def func3(a1):
#     print("我是func3函数")
#     value = (11, 22, 33, 44)
#     return value
#
#
# print(func1(1))
# # func2(11, a2=22)
# # func3(999)


#获取函数名
# def test():
#     pass
# print(test.__name__) # test
# def auth(func):
#     def inner(*args, **kwargs):
#         return func(*args, **kwargs)
#     return inner
#
# @auth
# def test():
#     pass
# test()
# print(test.__name__) # inner


# import functools
# def auth(func):
#     @functools.wraps(func)
#     def inner(*args, **kwargs):
#         return func(*args, **kwargs)
#     return inner
#
# @auth
# def myfunc():
#     pass
#
# myfunc()
# print(myfunc.__name__) # myfunc

# import functools
# def auth(func):
#     @functools.wraps(func)
#     def inner(*args, **kwargs):
#         """巴巴里吧"""
#         res = func(*args, **kwargs)  # 执行原函数
#         print(args)
#         print(kwargs)
#         return res
#
#     return inner
# @auth
# def func(*args, **kwargs):
#     pass
#
# print(func(1,2,name="xiaofeng"))
# print(func.__name__)

# def task(src):
#     def inner():
#         print(src)
#     return inner
#
# task('hello')()
